// PGLLinearNumbering.h: interface for the CPGLLinearNumbering class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PGLLINEARNUMBERING_H__FDB56A16_6F48_4C9D_BBF7_06F1ECADED1E__INCLUDED_)
#define AFX_PGLLINEARNUMBERING_H__FDB56A16_6F48_4C9D_BBF7_06F1ECADED1E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pgl/core/PGLNumbering.h>

class CPGLLinearNumbering : public CPGLNumbering  
{
PGL_DECLARE_DYNCREATE( CPGLLinearNumbering );
public:
	//! \name Constructors
	//@{
	/*! \brief Default constructor

	\param eOrientation orientation, default is horizontal

	*/
	explicit CPGLLinearNumbering(ESide eSide = SideLeft);
	virtual ~CPGLLinearNumbering();
	//@}


	/*! \brief Processes the limits

	\param dStart minimum of coordinate
	\param dEnd maximum of coordinate
	\param gfx graphic interface
	\return dStart new minimum
	\return dEnd new maximum

	\sa CPGLNumbering::ProcessLimits
	*/
	virtual void ProcessLimits(
		double& dStart, 
		double& dEnd, 
		gfxinterface::CGfxInterface& gfx
		);
	virtual void ComputeExtent(CPGLRectD& r);

	//! Computes nice axis limits
	void GenerateSteps();
	int GetExponentScaling( double dStart, double dEnd, double dExpLimit);

	//! Sets the limits
	void SetLimits( double dStart, double dEnd, double dStep );
	//! returns the start coordinate
	double GetStart() const						
	{	return m_dStart*pow(10.0,m_iScale);};
	//! returns the end coordinate
	double GetEnd() const						
	{	return m_dEnd*pow(10.0,m_iScale);};
	//! returns the step length
	double GetStep() const						
	{	return m_dStep*pow(10.0,m_iScale);};

	//! Draws the axis
	void PlotGfx(
		CPGLRectD const& region_rect_,
		CPGLRectD const& numbering_rect_,
		gfxinterface::CGfxInterface& gfx);

	//! \name Serialization and debugging
	//@{
	//! Serialization
	void SerializeXML( CPGLArchive& ar);
	#ifdef _DEBUG
		//! MFC Dump
		virtual void Dump( CDumpContext& dc ) const;
		//! MFC AssertValid
		virtual void AssertValid() const;    // Override
	#endif
	//@}


protected:
	CString m_sNumberFormat;
	double m_dStart;
	double m_dEnd;
	double m_dStep;
	int m_iScale;
	double m_dNumberExpLimits;

};

PGL_DECLARE_SMARTPTR( CPGLLinearNumbering );

#endif // !defined(AFX_PGLLINEARNUMBERING_H__FDB56A16_6F48_4C9D_BBF7_06F1ECADED1E__INCLUDED_)
